package com.lmn.file_upload;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class ControllerTest {

    @Autowired
    private FileUploadClient fileUploadClient;

    @RequestMapping("/uploadFile")
    public Object ploadFile(@RequestPart(value = "file") MultipartFile file, String fileType) {
        return fileUploadClient.uploadFile(file, fileType);
    }

    @RequestMapping("/downloadFile")
    public Object downloadFile(String fileType) {
        ResponseEntity<byte[]>  entity = fileUploadClient.downloadFile(fileType);
        return entity ;
    }


}
